package com.example.qxfw.nyqx.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.qxfw.common.entity.ny.QhYzpz;
import com.example.qxfw.nyqx.mapper.QhYzpzMapper;
import com.example.qxfw.nyqx.service.QhYzpzService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QhYzpzServiceImpl implements QhYzpzService {

    @Autowired
    private QhYzpzMapper qhYzpzMapper;

    @Override
    public List<QhYzpz> getList(String factorIndex) {
        return qhYzpzMapper.selectList(Wrappers.<QhYzpz>lambdaQuery().eq(QhYzpz::getFactorindex,factorIndex));
    }

    @Override
    public List<QhYzpz> getList1(String factorIndex, String fieldValue) {
        return qhYzpzMapper.selectList(Wrappers.<QhYzpz>lambdaQuery().eq(QhYzpz::getFactorindex,factorIndex).eq(QhYzpz::getFieldvalue,fieldValue));
    }

    @Override
    public Integer save(QhYzpz qhYzpz) {
        return qhYzpzMapper.insert(qhYzpz);
    }

    @Override
    public Integer update(QhYzpz qhYzpz) {
        return qhYzpzMapper.update(qhYzpz,Wrappers.<QhYzpz>lambdaUpdate().eq(QhYzpz::getFactorindex,qhYzpz.getFactorindex()).eq(QhYzpz::getFieldvalue,qhYzpz.getFieldvalue()));
    }

    @Override
    public Integer delete(String factorIndex, String fieldValue) {
        return qhYzpzMapper.delete(Wrappers.<QhYzpz>lambdaQuery().eq(QhYzpz::getFactorindex,factorIndex).eq(QhYzpz::getFieldvalue,fieldValue));
    }
}
